package cn.kust.tarvelService.service.impl;

import cn.kust.tarvelService.mapper.ArticleMapper;
import cn.kust.tarvelService.service.ArticleCommentService;
import cn.kust.tarvelService.service.ArticleService;
import cn.kust.tarvelService.pojo.Article;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 游记管理表 服务实现类
 * </p>
 *
 * @author testjava
 * @since 2022-07-26
 */
@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article> implements ArticleService {

    @Autowired
    private ArticleCommentService commentService;

    @Override
    public Article getByIdArticle(Long articleId) {
        QueryWrapper<Article> articleQueryWrapper = new QueryWrapper<>();
        articleQueryWrapper.eq("id",articleId);
        return baseMapper.selectOne(articleQueryWrapper);
    }

    @Override
    public void updateArticle(Article articleInfo) {
        QueryWrapper<Article> articleQueryWrapper = new QueryWrapper<>();
        articleQueryWrapper.eq("id",articleInfo.getId());
        int update = baseMapper.update(articleInfo, articleQueryWrapper);
    }
}
